Skip to content

Conversation

Spooky-Firefox
Copy link

@Spooky-Firefox Spooky-Firefox commented Oct 3, 2025

This pull request introduces a new "trampoline" feature for hardware tasks in RTIC, allowing an interrupt handler to pend another interrupt (the trampoline), which then executes the actual task code. This improves interrupt handling flexibility and source masking safety( As some exceptions can't be masked through NVIC). The implementation includes changes to parsing, code generation, and error checking for correct usage. The PR also contains a small fix to CI and a minor improvement to the rtic-monotonics crate for clippy compliance.

Trampoline Feature for Hardware Tasks

  • Added support for the trampoline argument in hardware task definitions, allowing the interrupt handler to pend another interrupt (the trampoline), which runs the task code. This is parsed and stored in HardwareTaskArgs. [1] [2]
  • Updated code generation so that, if a trampoline is specified, the original interrupt handler only pends the trampoline, and the trampoline handler executes the task logic. [1] [2]
  • Enhanced source masking logic to include trampoline interrupts in masking and priority setup, and added error checks to prevent exceptions from being used incorrectly with trampolines and shared resources. [1] [2] [3]

Documentation and Changelog Updates

  • Updated changelogs to document the new trampoline feature and related source masking error behavior. [1] [2]

Miscellaneous Improvements

  • Changed modulo operation to is_multiple_of() in rtic-monotonics for clippy compliance and CI passing. [1] [2]
  • Fixed a CI issue by removing a leading space in a test output file.

These changes collectively improve the flexibility and safety of interrupt handling in RTIC, while also addressing minor CI and linting issues.

For more details, see issue #1088.

@Spooky-Firefox Spooky-Firefox marked this pull request as draft October 3, 2025 18:24
@Spooky-Firefox Spooky-Firefox marked this pull request as ready for review October 6, 2025 14:50
Copy link
Contributor

@AfoHT AfoHT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned on Matrix nitpicks so far, generally good stuff :)

Comment on lines +1 to +11
//! examples/bouncy_trampoline.rs
#![no_std]
#![no_main]
#![deny(warnings)]
#![deny(unsafe_code)]
#![deny(missing_docs)]

use panic_semihosting as _;

// `examples/bouncy_trampoline.rs` testing trampoline feature
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Filename and comment are disagreeing :)


### Changed

- changed (sysclk % timer_hz) == 0 to sysclk.is_multiple_of(timer_hz) to make clippy happy as required to CI.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI always uses latest stable Rust, so new versions bring in new lints/defaults all the time :)

Thank you for dealing with this, could you split out the 'rtic-monotonics' changes into a separate commit? If you want you could even create a separate PR for this, to help your colleague, that can be fast-tracked into master branch that way :)

Great you added to the CHANGELOG, but please add new entries above, building like a stack. Please cleanup the commentary and the double ### Changed headers while you're at it :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants